﻿
using Quartz;
using System;
using System.Threading.Tasks;
using wt.wine.Application.Common.Interfaces;

namespace wt.wine.Application.Job
{
    public class OrderStateJob : IJob
    {
        private readonly IordertableRepository _iorderRepository;
        private readonly IUsertableRepository _iusertableRepository;
        public OrderStateJob(IordertableRepository iorderRepository, IUsertableRepository iusertableRepository)
        {
            _iorderRepository = iorderRepository;
            _iusertableRepository = iusertableRepository;
        }
        public async Task Execute(IJobExecutionContext context)
        {
            DateTime dt_now = DateTime.Now.AddMinutes(-15);
            await _iorderRepository.EditOrderStateByTime(dt_now, context.CancellationToken);
            await _iusertableRepository.EditDeviceTableList(dt_now, context.CancellationToken);
        }
    }
}
